home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8636 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,gnu.gcc.help,comp.unix.programmer
  4. Subject: Re: Help for using bcopy function
  5. Date: 5 Mar 1996 07:51:17 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hhntlINNr3k@keats.ugrad.cs.ubc.ca>
  8. References: <4gl53u$4bv@kocrsv08.delcoelect.com> <ELIAS.96Feb27144032@cepheus.omicron.se> <31372F78.167EB0E7@pia.bt.co.uk> <y9ybumcc5i0.fsf@ernst.ida.his.se>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <y9ybumcc5i0.fsf@ernst.ida.his.se>,
  12. Stefan 'Stetson' Skoglund  <sp2stes1@ida.his.se> wrote:
  13.  >    >> bcopy() is not standard AFAIK. Use memcpy instead.
  14.  >
  15.  >
  16.  >    Alwyn> It's certainly standard on SunOS.
  17.  >
  18.  >Which version of SunOS ??? SunOS 2.4 doesn't have it in libc at least.
  19.  
  20. SunOS 2.4? Man, that is ancient. (Or you surely mean _Solaris_ 2.4?)
  21.  
  22.  >It do exist in /usr/ucblib/libucb.so but that is the bsd compatibility
  23.  >package which I try to stay away from. 
  24.  
  25. The bcopy() function is tolerable wherever inet socket programming is done.
  26. Everywhere else, memcpy().  A lot of programs that open sockets use functions
  27. like bcopy and bzero for traditional reasons (because the network programming
  28. interface is BSD derived, and these support functions travel wherever it does).
  29. Heck, they even work under Trumpet Winsock. (ugh!)
  30.  
  31. bcopy() is frequently used to copy an array of four characters representing an
  32. inet address (derived from the struct hostent structure which comes from
  33. gethostbyname()) over top of a struct in_addr (part of a struct sockaddr_in),
  34. which holds an unsigned int. It's ugly, but go figure.  :)
  35. -- 
  36.  
  37.